package com.app.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by Administrator on 2016/8/4.
 */
public class FlexViewPager extends ViewPager {


    private boolean scroll = false;

    public FlexViewPager(Context context) {
        super(context);
    }

    public FlexViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    public boolean isScroll() {
        return scroll;
    }

    public void setScroll(boolean scroll) {
        this.scroll = scroll;
    }

    @Override
    public boolean onTouchEvent(MotionEvent arg0) {
        /* return false;//super.onTouchEvent(arg0); */
        if (scroll)
            return super.onTouchEvent(arg0);
        else
            return false;

    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        if (scroll)
            return super.onInterceptTouchEvent(arg0);
        else
            return false;

    }

}
